package com.epk.pic.vo.base;

import com.github.pagehelper.Page;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class TableDataInfo<T> implements Serializable {
    private Long total;
    private int code;
    private String message;
    private List<T> rows;

    public static <T> TableDataInfo<T> build(Page<?> page,List<T> rows){
        TableDataInfo<T> tableDataInfo = new TableDataInfo<>();
        tableDataInfo.setCode(200);
        tableDataInfo.setMessage("查询成功");
        tableDataInfo.setRows(rows);
        tableDataInfo.setTotal(page.getTotal());
        return tableDataInfo;
    }
}
